<template>
  <el-card class="box-card">
    <template #header>
      <div class="card-header">
        <span>{{ props.info.title }}</span>
        <el-tag
          class="fl-right tag-hover-pointer"
          type="success"
        >
          {{ props.info.date }}
        </el-tag>
      </div>
    </template>
    <div>
      <el-row>
        <span class="number">{{ '昨日' === props.info.date ? props.info.yesterday : props.info.today }}</span>
      </el-row>
      <el-row>
        <el-space size="large">
          <span class="ratio-percent">日环比{{ props.info.today_ratio }}% <el-icon :class="`el-icon-caret-${props.info.today_ratio >= 0 ? 'top' : 'bottom'}`" /> </span>
          <span class="ratio-percent">日环比{{ props.info.week_ratio }}% <el-icon :class="`el-icon-caret-${props.info.week_ratio >= 0 ? 'top' : 'bottom'}`" /></span>
        </el-space>
      </el-row>
    </div>
    <el-divider />
    <div class="card-footer">
      <span>{{ props.info.total_name }}</span>
      <span class="fl-right">
        {{ props.info.total }}
      </span>
    </div>
  </el-card>
</template>

<script lang="ts" setup>
import type { IHeaderInfo } from '@/api/types/home'
import type { PropType } from 'vue'

const props = defineProps({
  info: {
    type: Object as PropType<IHeaderInfo>,
    default: () => {}
  }
})
</script>

  <style lang="scss" scoped>
.box-card {
  padding: 0px;
  margin-bottom: 10px;
  font-size: 14px;
}
:deep(.el-card__body) {
  padding: 12px;
  & .number {
    font-size: 30px;
    margin-bottom: 10px;
  }
  & .ratio-percent {
    font-size: 14px;
    display: inline-block;
    & .el-icon.el-icon-caret-top{
      color: red;
    }
    & .el-icon.el-icon-caret-bottom{
      color: green;
    }
  }
  .card-footer {
    font-size: 14px;
    margin-top: -16px;
  }
}
.fl-right {
  float: right;
}
.tag-hover-pointer {
  cursor: pointer;
}
  </style>
